package labelsystem.Controller;/**
 * @projectName careOlder
 * @Description TODO
 * @author MCG
 * @time 2023/4/1 17:01
 */

import io.swagger.annotations.ApiOperation;
import labelsystem.Service.msgService;
import labelsystem.Service.scheduleService;
import org.slf4j.Logger;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;

import javax.annotation.Resource;
import java.util.List;

/**
 *description: TODO
 *@author MCG
 *@date 2023/4/1 17:01
 *@Version 1.0
 */
@Controller
@Component
public class scheduleController {
    @Resource
    private scheduleService scheduleService;
    @Resource
    private msgService msgService;

    @Scheduled(cron = "0 50 23 * * * ")
    @ApiOperation("定时回滚发消息，与前端无关无关！！！")
    public void timedAttention(){
       List<Long> phones=scheduleService.needMonitor();
       if(phones.size()!=0){
           for(Long phone:phones){
                  msgService.sendAttentionMSG(phone,"11404");
           }
       }
    }
}
